package com.jymj.common.config;

import org.springframework.web.multipart.commons.CommonsMultipartResolver;

/**
 * 文件上传解析器配置类
 *
 * @author haosai
 */
//@Configuration
public class CommonsMultipartResolverConfig {

    //@Bean
    public CommonsMultipartResolver commonsMultipartResolver() {
        CommonsMultipartResolver resolver = new CommonsMultipartResolver();
        resolver.setDefaultEncoding("UTF-8");
        resolver.setResolveLazily(true);//resolveLazily属性启用是为了推迟文件解析，以在在UploadAction中捕获文件大小异常
        resolver.setMaxInMemorySize(40960);
        resolver.setMaxUploadSize(50 * 1024 * 1024);//上传文件大小 50M 50*1024*1024
        return resolver;
    }
}
